# -*- mode: python ; coding: utf-8 -*-

import sys  # 确保导入 sys 模块

block_cipher = None

# 新增：排除不必要的模块
a = Analysis(
    ['random_number02.py'],
    pathex=['.'],
    binaries=[],
    datas=[('school_logo.jpg', '.')],  # 确保图片路径正确
    hiddenimports=[  # 添加 Pillow 的核心子模块
        'numpy', 'pandas',
        'PIL._imaging',
        'PIL.Image',
        'PIL.ImageTk'
    ],
    hookspath=['hooks'],
    excludes=[  # 移除所有 PIL.*ImagePlugin 排除项
        'scipy', 'matplotlib',
        'PyQt5', 'PySide2', 'PySide6', 'PyQt6'
    ],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
)

# 新增：强制使用UPX压缩并指定路径
pyz = PYZ(a.pure, upx=True, upx_exclude=[])

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='random_number02',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,
)
